#include "HeroBullet.h"

HeroBullet::HeroBullet() :m_isRelease(false)
{
}

HeroBullet::~HeroBullet()
{

}

bool HeroBullet::init()
{
	if (!CCNode::init())
	{
		return false;
	}
	this->setAnchorPoint(ccp(0.5, 0.5));
	CCSpriteFrame* frame1 = CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("bomb19.png");
	CCSpriteFrame* frame2 = CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("bomb23.png");
	CCSpriteFrame* frame3 = CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("bomb24.png");

	CCSprite* bullet = CCSprite::createWithSpriteFrame(frame1);
	this->setContentSize(bullet->getContentSize());
	CCSize size = this->getContentSize();

	bullet->setPosition(ccp(size.width / 2, size.height / 22));
	bullet->setScale(0.5);
	this->addChild(bullet);

	CCAnimation* animation = CCAnimation::create();
	animation->addSpriteFrame(frame1);
	animation->addSpriteFrame(frame2);
	animation->addSpriteFrame(frame3);
	animation->setDelayPerUnit(0.3f);
	animation->setRestoreOriginalFrame( true );
	CCAnimate* animate = CCAnimate::create(animation);
	bullet->runAction(CCRepeatForever::create(animate));



	return true;
}